import { createBrowserRouter, Navigate } from 'react-router-dom'
import App from '../App'
import { lazy, Suspense } from 'react'

const Myhome = lazy(() => import('../pages/Myhome'))
const Login = lazy(() => import('../pages/Login'))

const router = createBrowserRouter([
    {
        path: '/',
        element: <App />,
        children: [
            {
                path: 'home',
                element: <Suspense fallback={<div>loading...</div>}>
                    <Myhome />
                </Suspense>
            },
            {
                path:'login',
                element:<Suspense fallback={<div>loading...</div>}><Login/></Suspense>
            },
            {
                path:'/',
                element:<Navigate to='/login'/>
            }
        ]
    }
])

export default router
